import VueRouter from 'vue-router'

// 引入组件
import login from "@/router/pages/login";
import Home from "@/views/home/Home";
// import Article from "@/router/pages/Article";
import PayBook from "@/router/pages/PayBook";
import Register from "@/router/pages/Register";
import ThingsDownload from "@/router/pages/ThingsDownload/ThingsDownload";
import OnlineAudio from "@/router/pages/OnlineAudio/OnlineAudio";
import ArticleTopics from "@/router/pages/ArticleTopics/ArticleTopics";

import BookDetail from "@/router/pages/PayBookList/BookDetail/BookDetail";
import Pay from "@/views/pay/Pay";
import toPay from "@/views/pay/toPay/ToPay";
import Header from "@/components/Header";
// import PersonInfo from "@/views/home/personInfo/PersonInfo";
import FindPassword from "@/views/findPassword/FindPassword";
import ArticleDetail from "@/router/pages/ArticleTopics/ArticleDetail";
import PurchasePage from "@/views/PurchasePage/PurchasePage";
import AudioList from "@/router/pages/OnlineAudio/AudioList";
// import GetAddress from "@/router/pages/address/GetAddress";
import PersonCenter from "@/views/home/personInfo/PersonCenter";
import MyOrder from "../views/pay/order/MyOrder";
import DetailToOrder from "../views/pay/toPay/DetailToOrder";
import ToPayBuy from "@/views/pay/toPay/ToPayBuy"
import toComment from "../views/pay/comment/toComment";
import OrderDetail from "../views/pay/order/OrderDetail";


export default new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/home',

        },
        {
            name: 'userLogin',
            path: '/login',
            component: login
        },
        {
            name: 'header',
            path: '/header',
            component: Header
        },
        {
            name: 'HomePage',
            path: '/home',
            component: Home,
            children: [
                {
                    path: '/smallSub',
                    component: () => import('@/views/home/components/index_components/smallSub/SmallSub')
                }
            ]
        },
        {
            name: 'article',
            path: '/article',
            component: ArticleTopics
        },
        {
            name: 'paybook',
            path: '/paybook',
            component: PayBook
        },
        {
            name: 'userRegister',
            path: '/Register',
            component: Register
        },
        {
            name: 'thingsdownload',
            path: '/thingsdownload',
            component: ThingsDownload
        },
        {
            name: 'onlineAudio',
            path: '/onlineAudio',
            component: OnlineAudio
        },
        {
            name: 'bookDetail',
            path: '/bookdetail',
            component: BookDetail
        },
        {
            name: 'Pay',
            path: '/pay',
            component: Pay
        },
        {
            name: 'toPay',
            path: '/toPay',
            component: toPay
        },
        {
            name: 'toPayBuy',
            path: '/toPayBuy',
            component: ToPayBuy
        },
        // {
        //     name:'personInfo',
        //     path: '/personInfo',
        //     component: PersonInfo
        // },
        {
            name: 'findPassword',
            path: '/findPassword',
            component: FindPassword
        },
        {
            name: 'articleDetail',
            path: '/articleDetail',
            component: ArticleDetail
        },
        {
            name: 'purchasePage',
            path: '/purchasePage',
            component: PurchasePage
        },
        {
            name: 'AudioList',
            path: '/audioList',
            component: AudioList
        }, {
            name: 'MyOrder',
            path: '/myOrder',
            component: MyOrder
        }, {
            name: 'DetailToOrder',
            path: '/detailToOrder',
            component: DetailToOrder
        },{
            name: 'ToComment',
            path: '/toComment',
            component: toComment
        }, {
            name: 'OrderDetail',
            path: '/orderDetail',
            component: OrderDetail
        },
        // {
        //     name: 'GetAddress',
        //     path: '/getAddress',
        //     component: GetAddress
        // },
        {
            name: 'PersonCenter',
            path: '/personCenter',
            component: PersonCenter,
            children: [
                {
                    path: 'myOrder',
                    component: () => import('@/views/pay/order/MyOrder')
                },
                {
                    path: 'PersonInfo',
                    component: () => import('@/views/home/personInfo/PersonInfo'),
                },
                {
                    path: 'getAddress',
                    component: () => import('@/router/pages/address/GetAddress')
                },
                {
                    path: 'editPassword',
                    component: () => import('@/views/home/personInfo/EditPassword')
                },
                {
                    path: 'myCollection',
                    component: () => import('@/views/home/personInfo/MyCollection')
                }
            ]
        }
    ]
})

export const asyncRouterMap = [
    {
        path: '*', redirect: '/404', hidden: true
    },
    // {
    //     path: '/pms',
    //     component: ,
    //     redirect: '/pms/product',
    //     name: 'pms',
    //     meta:{title: '商品'}
    // }
]